/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package mx.edu.itschapala.sistemas.septimo.Vista;

import javax.swing.JFrame;
import javax.swing.UIManager;
import mx.edu.itschapala.sistemas.septimo.Control.ClienteLnLista;
import mx.edu.itschapala.sistemas.septimo.Control.ClienteLnLocal;
import mx.edu.itschapala.sistemas.septimo.Control.ProductoLnLista;
import mx.edu.itschapala.sistemas.septimo.Control.ProductoLnLocal;
import mx.edu.itschapala.sistemas.septimo.Modelo.Cliente;
import mx.edu.itschapala.sistemas.septimo.Modelo.Producto;
import mx.edu.itschapala.sistemas.septimo.Vista.enumeracion.TipoVentana;
/**
 *
 * @author Sony
 */
public class MenuPrincipal extends javax.swing.JFrame {
      private JFrame ventana;
      
    /**
     * Creates new form MenuPrincipal
     */
    public MenuPrincipal() {
        try{
            UIManager.setLookAndFeel("com.jtattoo.plaf.texture.patterns.show.window_texture");
            //  UIManager.setLookAndFeel("com.jtattoo.plaf.noire.NoireLookAndFeel");
            }catch(Exception ex){
                ex.printStackTrace();
            
        }
        initComponents();
        
        productoControl.registrar(new Producto(12,"JABON",12.5f, "ABARROTE", "JABON NEGRO"));
        productoControl.registrar(new Producto(13,"PEPSI",12.5f, "ABARROTE", "JABON NEGRO"));
        productoControl.registrar(new Producto(14,"JAMON",12.5f, "ABARROTE", "JABON NEGRO"));
        productoControl.registrar(new Producto(15,"SALCHICHA",12.5f, "ABARROTE", "JABON NEGRO"));
        productoControl.registrar(new Producto(16,"XXX",12.5f, "ABARROTE", "JABON NEGRO"));
        productoControl.registrar(new Producto(17,"SALVO",12.5f, "ABARROTE", "JABON NEGRO"));
        productoControl.registrar(new Producto(18,"MONTANA",12.5f, "ABARROTE", "JABON NEGRO"));
        
        
        infoCliente.Clienteregistrar(new Cliente ("MARIA","MUJER",1,33124567, "AV MORELOS"));
        infoCliente.Clienteregistrar(new Cliente ("JUAN","HOMBRE",2,33124567, "AV MORELOS"));
        infoCliente.Clienteregistrar(new Cliente ("PEDRO","HOMBRE",3,33124567, "AV MORELOS"));
        infoCliente.Clienteregistrar(new Cliente ("MIGUEL","HOMBRE",4,33124567, "AV MORELOS"));
        infoCliente.Clienteregistrar(new Cliente ("LUIS","HOMBRE",5,33124567, "AV MORELOS"));
        infoCliente.Clienteregistrar(new Cliente ("LEONARDO","HOMBRE",1,33124567, "AV MORELOS"));
        infoCliente.Clienteregistrar(new Cliente ("CARLOS","HOMBRE",6,33124567, "AV MORELOS"));
        infoCliente.Clienteregistrar(new Cliente ("ANTONIO","HOMBRE",7,33124567, "AV MORELOS"));
        infoCliente.Clienteregistrar(new Cliente ("MAURICIO","HOMBRE",8,33124567, "AV MORELOS"));
        
      
       
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    
    private ProductoLnLocal productoControl = new ProductoLnLista();
    private ClienteLnLocal infoCliente = new ClienteLnLista();
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jMenuItem4 = new javax.swing.JMenuItem();
        jMenu5 = new javax.swing.JMenu();
        jMenuItem5 = new javax.swing.JMenuItem();
        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        RegistrarProducto = new javax.swing.JMenuItem();
        EditarProducto = new javax.swing.JMenuItem();
        BuscarProducto = new javax.swing.JMenuItem();
        EliminarProducto = new javax.swing.JMenuItem();
        ListarProducto = new javax.swing.JMenuItem();
        jMenu2 = new javax.swing.JMenu();
        RegistraCliente = new javax.swing.JMenuItem();
        EditarCliente = new javax.swing.JMenuItem();
        BuscarCliente = new javax.swing.JMenuItem();
        EminarCliente = new javax.swing.JMenuItem();
        ListarCliente = new javax.swing.JMenuItem();
        jMenu3 = new javax.swing.JMenu();
        jMenuItem11 = new javax.swing.JMenuItem();
        jMenuItem12 = new javax.swing.JMenuItem();
        jMenuItem1 = new javax.swing.JMenuItem();
        jMenuItem2 = new javax.swing.JMenuItem();
        jMenuItem3 = new javax.swing.JMenuItem();
        jMenu4 = new javax.swing.JMenu();
        jMenuItem13 = new javax.swing.JMenuItem();
        jMenuItem14 = new javax.swing.JMenuItem();
        jMenu6 = new javax.swing.JMenu();
        jMenuItem6 = new javax.swing.JMenuItem();

        jMenuItem4.setText("jMenuItem4");

        jMenu5.setText("jMenu5");

        jMenuItem5.setText("jMenuItem5");

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

        jPanel1.setBackground(new java.awt.Color(204, 204, 255));
        jPanel1.setForeground(new java.awt.Color(204, 204, 255));

        jLabel1.setIcon(new javax.swing.ImageIcon("C:\\Users\\Sony\\Pictures\\Fotos proyecto\\Compras1.jpg")); // NOI18N
        jLabel1.setText("jLabel1");

        jLabel2.setIcon(new javax.swing.ImageIcon("C:\\Users\\Sony\\Pictures\\Fotos proyecto\\Minisuper3.jpg")); // NOI18N
        jLabel2.setText("jLabel2");

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(42, 42, 42)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 222, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(10, 10, 10)
                        .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 196, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(53, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGap(42, 42, 42))
        );

        jMenuBar1.setBackground(new java.awt.Color(153, 153, 153));
        jMenuBar1.setForeground(new java.awt.Color(153, 153, 153));

        jMenu1.setText("Producto");

        RegistrarProducto.setText("Registrar");
        RegistrarProducto.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                RegistrarProductoActionPerformed(evt);
            }
        });
        jMenu1.add(RegistrarProducto);

        EditarProducto.setText("Editar");
        EditarProducto.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                EditarProductoActionPerformed(evt);
            }
        });
        jMenu1.add(EditarProducto);

        BuscarProducto.setText("Buscar");
        BuscarProducto.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BuscarProductoActionPerformed(evt);
            }
        });
        jMenu1.add(BuscarProducto);

        EliminarProducto.setText("Eliminar");
        EliminarProducto.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                EliminarProductoActionPerformed(evt);
            }
        });
        jMenu1.add(EliminarProducto);

        ListarProducto.setText("Listar");
        ListarProducto.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ListarProductoActionPerformed(evt);
            }
        });
        jMenu1.add(ListarProducto);

        jMenuBar1.add(jMenu1);

        jMenu2.setText("Cliente");

        RegistraCliente.setText("Registrar Cliente");
        RegistraCliente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                RegistraClienteActionPerformed(evt);
            }
        });
        jMenu2.add(RegistraCliente);

        EditarCliente.setText("Editar Cliente");
        EditarCliente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                EditarClienteActionPerformed(evt);
            }
        });
        jMenu2.add(EditarCliente);

        BuscarCliente.setText("Buscar Cliente");
        BuscarCliente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BuscarClienteActionPerformed(evt);
            }
        });
        jMenu2.add(BuscarCliente);

        EminarCliente.setText("Eliminar Cliente");
        EminarCliente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                EminarClienteActionPerformed(evt);
            }
        });
        jMenu2.add(EminarCliente);

        ListarCliente.setText("ListarCliente");
        ListarCliente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ListarClienteActionPerformed(evt);
            }
        });
        jMenu2.add(ListarCliente);

        jMenuBar1.add(jMenu2);

        jMenu3.setText("Venta");

        jMenuItem11.setText("Registrar Venta");
        jMenuItem11.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem11ActionPerformed(evt);
            }
        });
        jMenu3.add(jMenuItem11);

        jMenuItem12.setText("Editar Venta");
        jMenuItem12.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem12ActionPerformed(evt);
            }
        });
        jMenu3.add(jMenuItem12);

        jMenuItem1.setText("Buscar Venta");
        jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        jMenu3.add(jMenuItem1);

        jMenuItem2.setText("Eliminar Venta");
        jMenu3.add(jMenuItem2);

        jMenuItem3.setText("Listar Venta");
        jMenu3.add(jMenuItem3);

        jMenuBar1.add(jMenu3);

        jMenu4.setText("Ayuda");

        jMenuItem13.setText("Tutoriales ");
        jMenuItem13.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem13ActionPerformed(evt);
            }
        });
        jMenu4.add(jMenuItem13);

        jMenuItem14.setText("Acerca de");
        jMenuItem14.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem14ActionPerformed(evt);
            }
        });
        jMenu4.add(jMenuItem14);

        jMenuBar1.add(jMenu4);

        jMenu6.setText("Salir");

        jMenuItem6.setText("Salir");
        jMenuItem6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem6ActionPerformed(evt);
            }
        });
        jMenu6.add(jMenuItem6);

        jMenuBar1.add(jMenu6);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 0, 0))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void EditarProductoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_EditarProductoActionPerformed
       new ProductoCrearEditar(null,productoControl,TipoVentana.VENTANA_EDITAR).setVisible(true);
    }//GEN-LAST:event_EditarProductoActionPerformed

    private void ListarProductoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ListarProductoActionPerformed
        if(ventana==null){
            ventana=new ProductoListar(productoControl);
        }
        ventana.setVisible(true);
       
    }//GEN-LAST:event_ListarProductoActionPerformed
     
   
    private void RegistrarProductoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RegistrarProductoActionPerformed
        new ProductoCrearEditar(null,productoControl,TipoVentana.VENTANA_REGISTRO).setVisible(true);
        //this.dispose();
    }//GEN-LAST:event_RegistrarProductoActionPerformed

    private void BuscarProductoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BuscarProductoActionPerformed
        new ProductoCrearEditar(null,productoControl,TipoVentana.VENTANA_BUSQUEDA).setVisible(true);
    }//GEN-LAST:event_BuscarProductoActionPerformed

    private void BuscarClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BuscarClienteActionPerformed
        new ClienteCrearEditar(null,infoCliente,TipoVentana.VENTANA_BUSQUEDA).setVisible(true);
    }//GEN-LAST:event_BuscarClienteActionPerformed

    private void jMenuItem11ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem11ActionPerformed
        //new VentasCrearEditar(null,productoControl,TipoVentana.VENTANA_REGISTRO).setVisible(true);
    }//GEN-LAST:event_jMenuItem11ActionPerformed

    private void jMenuItem12ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem12ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jMenuItem12ActionPerformed

    private void jMenuItem13ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem13ActionPerformed
        Tutoriales a = new  Tutoriales();
        a.setVisible(true);
        //this.dispose();
    }//GEN-LAST:event_jMenuItem13ActionPerformed

    private void jMenuItem14ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem14ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jMenuItem14ActionPerformed

    private void RegistraClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RegistraClienteActionPerformed
     new ClienteCrearEditar(null,infoCliente,TipoVentana.VENTANA_REGISTRO).setVisible(true);
    }//GEN-LAST:event_RegistraClienteActionPerformed

    private void EliminarProductoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_EliminarProductoActionPerformed
    new ProductoCrearEditar(null,productoControl,TipoVentana.VENTANA_ELIMINAR).setVisible(true);
    
    }//GEN-LAST:event_EliminarProductoActionPerformed

    private void EditarClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_EditarClienteActionPerformed
        new ClienteCrearEditar(null,infoCliente,TipoVentana.VENTANA_EDITAR).setVisible(true);
    }//GEN-LAST:event_EditarClienteActionPerformed

    private void EminarClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_EminarClienteActionPerformed
        new ClienteCrearEditar(null,infoCliente,TipoVentana.VENTANA_ELIMINAR).setVisible(true);
    }//GEN-LAST:event_EminarClienteActionPerformed

    private void ListarClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ListarClienteActionPerformed
       if(ventana==null){
            ventana=new ClienteListar(infoCliente);
        }
        ventana.setVisible(true);
       
    }//GEN-LAST:event_ListarClienteActionPerformed

    private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jMenuItem1ActionPerformed

    private void jMenuItem6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem6ActionPerformed
       this.dispose();
    }//GEN-LAST:event_jMenuItem6ActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(MenuPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(MenuPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(MenuPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(MenuPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new MenuPrincipal().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenuItem BuscarCliente;
    private javax.swing.JMenuItem BuscarProducto;
    private javax.swing.JMenuItem EditarCliente;
    private javax.swing.JMenuItem EditarProducto;
    private javax.swing.JMenuItem EliminarProducto;
    private javax.swing.JMenuItem EminarCliente;
    private javax.swing.JMenuItem ListarCliente;
    private javax.swing.JMenuItem ListarProducto;
    private javax.swing.JMenuItem RegistraCliente;
    private javax.swing.JMenuItem RegistrarProducto;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenu jMenu3;
    private javax.swing.JMenu jMenu4;
    private javax.swing.JMenu jMenu5;
    private javax.swing.JMenu jMenu6;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JMenuItem jMenuItem11;
    private javax.swing.JMenuItem jMenuItem12;
    private javax.swing.JMenuItem jMenuItem13;
    private javax.swing.JMenuItem jMenuItem14;
    private javax.swing.JMenuItem jMenuItem2;
    private javax.swing.JMenuItem jMenuItem3;
    private javax.swing.JMenuItem jMenuItem4;
    private javax.swing.JMenuItem jMenuItem5;
    private javax.swing.JMenuItem jMenuItem6;
    private javax.swing.JPanel jPanel1;
    // End of variables declaration//GEN-END:variables
}
